Repository navigation
Conversation
Reject allocation-size overflow and preserve full-width multiplication so the bundled allocator cannot silently allocate less than requested. Exercise the boundary in native CTest and 32-bit Windows CI. Files: zlib/zutil.c, tests/zlib-allocation-test.c, tests/unittests/CMakeLists.txt, .github/workflows/test-win-latest.yml Co-authored-by: Copilot <[email protected]> Copilot-Session: e5009227-6b49-4803-8153-63d8d94037e3
Express the same allocation checks without constant if conditions so the Windows 2022 compiler can enforce warnings as errors. Files: zlib/zutil.c, tests/zlib-allocation-test.c Co-authored-by: Copilot <[email protected]> Copilot-Session: e5009227-6b49-4803-8153-63d8d94037e3
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Security hardening
Fix the bundled zlib allocation-size calculation identified by the
cpp/integer-multiplication-cast-to-longCodeQL alert. The normal allocator now rejects products that its allocation argument cannot represent and multiplies at the appropriate width; the existing 16-bitcallocpath is unchanged. Exploitability through supported SDK APIs has not been established.Add a mocked-allocator regression test for normal, zero, failed and boundary allocations. Run it in the existing CTest suite and explicitly on Win32 in CI, where overflow rejection can be exercised. Keep the existing vendored-zlib warning suppression: removing it breaks builds that enable additional consumer warning flags such as
-Wconversion -Werror.Validation
git diff --check.The CTest runs above selected only the new allocation test; they are not claims of a complete test-suite run. This branch is based on current
main, whose unrelated public-header and runner-fixture failures are being fixed independently in #1566; merge that PR and update this branch frommainbefore final validation.